<!-- SCL-90症状自评量表 -->
<template>
	<view class="contaier" :style="{ minHeight: getHeight + 'px' }">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">SCL-90症状自评量表</block>
		</cu-custom>

		<view style="height: 250rpx;width: 1rpx;"></view>
		<!-- 答题主页面 -->
		<view class="padding">
			<view class="mainBox radius shadow-warp bg-white margin-top relative">
				<view class="userHeard cu-avatar lg round" style="background-image:url(http://cdn.zhoukaiwen.com/logo.png);"></view>
				<view v-show="hasData">
					<view class="animation-reverse shadow" :class="animation" data-class="slide-rights" v-if="DataList[num].serialNumber">
						<view class="mentalTitle text-xl text-black text-bold">
							<text>{{ DataList[num].serialNumber || '' }}</text>
							<text>、</text>
							<text>{{ DataList[num].title || '' }}</text>
						</view>
						<view class="mentalList" v-for="(item, index) in DataList[num].itemList" v-bind:class="{ mentalListActive: index == mentalListActive }" @tap="Toggle(index)">
							<view @click="answerchoose(DataList[num].serialNumber,index,item.answer)">
							<view class="indexBox text-shadow">{{ item.number || '' }}</view>
							{{ item.answer || '' }}
							</view>
						</view>
					</view>

					<u-line color="#dddddd"></u-line>

					<view class="margin-top cu-progress radius striped active">
						<view class="bg-blue" :style="[{ width: loading ? progress + '%' : '' }]">{{  progress }}%</view>
					</view>
					<view class="explainMain">本测试仅提供参考（答题自动保存在本地，支持中途退出）</view>
					<!--  {{useranswers}} --> 
				</view>
	
				<view v-show="noData">
					<view class="text-center text-bold text-black text-xxl margin-tb-xl">您已答题，感谢参与</view>
					<view class="text-center margin-tb-lg text-lg"><h3>IIMedGPT评测结果：</h3>总分：{{showMessage.allscore}} 总均分：{{showMessage.allscorejun}} 阳性项目数：{{showMessage.sunproject}} 阴性项目数：{{showMessage.moonproject}} 阳性症状均分：{{showMessage.yxzzjf}} 是否为阳性：{{showMessage.ifsun}}  躯体化分数：{{showMessage.qth}} 躯体化分数-五类分类：{{showMessage.qthif}} 强迫症状：{{showMessage.qpz}} 强迫症状-五类分类：{{showMessage.qpzif}} 人际关系敏感：{{showMessage.rjgxmg}} 人际关系敏感：{{showMessage.rjgxmgif}} 抑郁：{{showMessage.yy}} 抑郁-五类分类：{{showMessage.yyif}} 焦虑：{{showMessage.jl}} 焦虑-五类分类：{{showMessage.jlif}} 敌对：{{showMessage.dd}} 敌对-五类分类：{{showMessage.ddid}} 恐怖：{{showMessage.kb}} 恐怖-五类分类：{{showMessage.kbif}} 偏执：{{showMessage.pz}} 偏执-五类分类：{{showMessage.pzif}} 精神病性：{{showMessage.jsbx}} 精神病性-五类分类：{{showMessage.jsbxif}}  其他：{{showMessage.qita}} 其他-五类分类：{{showMessage.qitaif}}</view>
				</view>
			</view>
		</view>

		<view class="explain">
			<view @click="goExplain">
				<u-icon name="question-circle-fill" size="30"></u-icon>
				答题规则说明
				<!-- {{useranswers}} -->
			</view>
			
		</view>
<!-- {"allscore":"总分","allscorejun":"总均分","sunproject":"阳性项目数","moonproject":"阴性项目数","yxzzjf":"阳性症状均分","ifsun":"是否为阳性","qth":"躯体化分数","qthif":"躯体化分数-五类分类","qpz":"强迫症状","qpzif":"强迫症状-五类分类","rjgxmg":"人际关系敏感","rjgxmgif":"人际关系敏感-五类分类","yy":"抑郁","yyif":"抑郁-五类分类","jl":"焦虑","jlif":"焦虑-五类分类","dd":"敌对","ddid":"敌对-五类分类","kb":"恐怖","kbif":"恐怖-五类分类","pz":"偏执","pzif":"偏执-五类分类","jsbx":"精神病性","jsbxif":"精神病性-五类分类","qita":"其他","qitaif":"其他-五类分类"} -->
		<!-- 遮罩层 -->
		<u-mask :show="show">
			<view class="warp">
				<view class="rect" @tap.stop>
					<view class="closeBtn">
						<u-icon @click="closeMask" name="close-circle-fill" color="#ccc" size="58"></u-icon>
					</view>

					<view class="closeImg">
						<image mode="aspectFit" src="http://cdn.zhoukaiwen.com/answerTrophy.png"></image>
					</view>
					<view class="text-black text-bold text-center">恭喜您！完成答题！</view>
					<view class="text-center margin-tb-lg text-gray">总分：{{showMessage.allscore}} 总均分：{{showMessage.allscorejun}} 阳性项目数：{{showMessage.sunproject}} 阴性项目数：{{showMessage.moonproject}} 阳性症状均分：{{showMessage.yxzzjf}} 是否为阳性：{{showMessage.ifsun}}  躯体化分数：{{showMessage.qth}} 躯体化分数-五类分类：{{showMessage.qthif}} 强迫症状：{{showMessage.qpz}} 强迫症状-五类分类：{{showMessage.qpzif}} 人际关系敏感：{{showMessage.rjgxmg}} 人际关系敏感：{{showMessage.rjgxmgif}} 抑郁：{{showMessage.yy}} 抑郁-五类分类：{{showMessage.yyif}} 焦虑：{{showMessage.jl}} 焦虑-五类分类：{{showMessage.jlif}} 敌对：{{showMessage.dd}} 敌对-五类分类：{{showMessage.ddid}} 恐怖：{{showMessage.kb}} 恐怖-五类分类：{{showMessage.kbif}} 偏执：{{showMessage.pz}} 偏执-五类分类：{{showMessage.pzif}} 精神病性：{{showMessage.jsbx}} 精神病性-五类分类：{{showMessage.jsbxif}}  其他：{{showMessage.qita}} 其他-五类分类：{{showMessage.qitaif}}
					</view>
				</view>
			</view>
		</u-mask>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				show: false,
				getHeight: '',
				loading: false,
				animation: '',
		
				mentalListActive: -1,
				noData: false,
				hasData: true,
		
				// 数据
				num: 0,
				DataList: [
					{
						"serialNumber": "1",
						"title": "头痛",
						"itemList": [
							{ "number": "A", "answer": "从无" },
							{ "number": "B", "answer": "很轻" },
							{ "number": "C", "answer": "中等" },
							{ "number": "D", "answer": "偏重" },
							{ "number": "E", "answer": "严重" }
						]
					},
					{
					    "serialNumber": "2",
					    "title": "神经过敏，心中不踏实",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "3",
					    "title": "头脑中有不必要的想法或字句盘旋",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "4",
					    "title": "头晕或晕倒",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "5",
					    "title": "对异性的兴趣减退",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "6",
					    "title": "对旁人责备求全",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "7",
					    "title": "感到别人能控制您的思想",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "8",
					    "title": "责怪别人制造麻烦",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "9",
					    "title": "忘性大",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "10",
					    "title": "担心自己的衣饰及仪态的端正",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "11",
					    "title": "容易烦恼和激动",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "12",
					    "title": "胸痛",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "13",
					    "title": "害怕空旷的场所或街道",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "14",
					    "title": "感到自己的精力下降，活动减慢",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "15",
					    "title": "想结束自己的生命",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "16",
					    "title": "听到旁人听不到的声音",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "17",
					    "title": "发抖",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "18",
					    "title": "感到大多数人都不可信任",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "19",
					    "title": "胃口不好",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "20",
					    "title": "容易哭泣",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "21",
					    "title": "同异性相处时感到害羞不自在",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "22",
					    "title": "感到受骗，中了圈套或有人想抓住您",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "23",
					    "title": "无缘无故的突然感到害怕",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "24",
					    "title": "自己不能控制地大发脾气",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "25",
					    "title": "怕单独出门",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "26",
					    "title": "经常责怪自己",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "27",
					    "title": "腰痛",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "28",
					    "title": "感到难以完成任务",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "29",
					    "title": "感到孤独",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "30",
					    "title": "感到苦闷",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "31",
					    "title": "过分担忧",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "32",
					    "title": "对事物不感兴趣",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "33",
					    "title": "感到害怕",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
					    ]
					},
					{
					    "serialNumber": "34",
					    "title": "您的感情容易受到伤害",
					    "itemList": [
					        { "number": "A", "answer": "从无" },
					        { "number": "B", "answer": "很轻" },
					        { "number": "C", "answer": "中等" },
					        { "number": "D", "answer": "偏重" },
					        { "number": "E", "answer": "严重" }
						]
					},
					    {
					        "serialNumber": "35",
					        "title": "旁人能知道您的私下想法",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "36",
					        "title": "感到别人不理解您，不同情您",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "37",
					        "title": "感到人们对您不友好，不喜欢您",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "38",
					        "title": "做事必须做得很慢以保证做得正确",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "39",
					        "title": "心跳得很厉害",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "40",
					        "title": "恶心或胃部不舒服",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "41",
					        "title": "感到比不上他人",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "42",
					        "title": "肌肉酸痛",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "43",
					        "title": "感到有人在监视您，谈论您",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "44",
					        "title": "难以入睡",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "45",
					        "title": "做事必须反复检查",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "46",
					        "title": "难以做出决定",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "47",
					        "title": "怕乘电车，公共汽车，地铁或火车",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "48",
					        "title": "呼吸有困难",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "49",
					        "title": "一阵阵发冷或发热",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "50",
					        "title": "因为感到害怕而避开某些东西、场合或活动",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "51",
					        "title": "脑子变空了",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "52",
					        "title": "身体发麻或刺痛",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "53",
					        "title": "喉咙有梗塞感",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },						
						{
						    "serialNumber": "54",
						    "title": "感到前途没有希望",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
					    {
					        "serialNumber": "55",
					        "title": "不能集中注意力",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "56",
					        "title": "感到身体的某一部分软弱无力",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "57",
					        "title": "感到紧张或容易紧张",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "58",
					        "title": "感到手或脚发重",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "59",
					        "title": "想到死亡的事",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "60",
					        "title": "吃得太多",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "61",
					        "title": "当别人看着您或谈论您时感到不自在",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "62",
					        "title": "有一些不属于您自己的想法",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "63",
					        "title": "有想打人或伤害他人的冲动",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "64",
					        "title": "醒得太早",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "65",
					        "title": "必须反复洗手、点数",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "66",
					        "title": "睡得不稳不深",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "67",
					        "title": "有想摔坏或破坏东西的冲动",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "68",
					        "title": "有一些别人没有的想法",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					            { "number": "B", "answer": "很轻" },
					            { "number": "C", "answer": "中等" },
					            { "number": "D", "answer": "偏重" },
					            { "number": "E", "answer": "严重" }
					        ]
					    },
					    {
					        "serialNumber": "69",
					        "title": "感到对别人神经过敏",
					        "itemList": [
					            { "number": "A", "answer": "从无" },
					                    { "number": "B", "answer": "很轻" },
					                    { "number": "C", "answer": "中等" },
					                    { "number": "D", "answer": "偏重" },
					                    { "number": "E", "answer": "严重" }
					         ]
					    },
						{
						    "serialNumber": "70",
						    "title": "在商店或电影院等人多的地方感到不自在",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "71",
						    "title": "感到任何事情都很困难",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "72",
						    "title": "一阵阵恐惧或惊恐",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "73",
						    "title": "感到公共场合吃东西很不舒服",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "74",
						    "title": "经常与人争论",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "75",
						    "title": "单独一人时神经很紧张",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "76",
						    "title": "别人对您的成绩没有做出恰当的评价",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "77",
						    "title": "即使和别人在一起也感到孤单",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "78",
						    "title": "感到坐立不安心神不宁",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "79",
						    "title": "感到自己没有什么价值",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "80",
						    "title": "感到熟悉的东西变成陌生或不像是真的",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "81",
						    "title": "大叫或摔东西",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "82",
						    "title": "害怕会在公共场合晕倒",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "83",
						    "title": "感到别人想占你便宜",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "84",
						    "title": "为一些有关性的想法而很苦恼",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "85",
						    "title": "您认为应该因为自己的过错而受到惩罚",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "86",
						    "title": "感到要很快把事情做完",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "87",
						    "title": "感到自己的身体有严重问题",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "88",
						    "title": "从未感到和其他人很亲近",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
						{
						    "serialNumber": "89",
						    "title": "感到自己有罪",
						    "itemList": [
						        { "number": "A", "answer": "从无" },
						        { "number": "B", "answer": "很轻" },
						        { "number": "C", "answer": "中等" },
						        { "number": "D", "answer": "偏重" },
						        { "number": "E", "answer": "严重" }
						    ]
						},
					{
						"serialNumber": "90",
						"title": "感到自己脑子有毛病",
						"itemList": [
							{ "number": "A", "answer": "从无" },
							{ "number": "B", "answer": "很轻" },
							{ "number": "C", "answer": "中等" },
							{ "number": "D", "answer": "偏重" },
							{ "number": "E", "answer": "严重" }
						]
					}
				], // 这里添加逗号
		
				useranswers: {   
					"user_id": "1",
					"idd":"",
					"answers": {
						"q1": "3",
						"q2": "2",
						"q3": "1",
						"q4": "5",
						"q5": "2",
						"q6": "1",
						"q7": "3",
						"q8": "2",
						"q9": "1",
						"q10": "5",
						"q11": "3",
						"q12": "2",
						"q13": "1",
						"q14": "5",
						"q15": "2",
						"q16": "1",
						"q17": "3",
						"q18": "2",
						"q19": "1",
						"q20": "5",
						"q21": "3",
						"q22": "2",
						"q23": "1",
						"q24": "5",
						"q25": "2",
						"q26": "1",
						"q27": "3",
						"q28": "2",
						"q29": "1",
						"q30": "5",
						"q31": "3",
						"q32": "2",
						"q33": "1",
						"q34": "5",
						"q35": "2",
						"q36": "1",
						"q37": "3",
						"q38": "2",
						"q39": "1",
						"q40": "5",
						"q41": "3",
						"q42": "2",
						"q43": "1",
						"q44": "5",
						"q45": "2",
						"q46": "1",
						"q47": "3",
						"q48": "2",
						"q49": "1",
						"q50": "5",
						"q51": "3",
						"q52": "2",
						"q53": "1",
						"q54": "5",
						"q55": "2",
						"q56": "1",
						"q57": "3",
						"q58": "2",
						"q59": "1",
						"q60": "5",
						"q61": "3",
						"q62": "2",
						"q63": "1",
						"q64": "5",
						"q65": "2",
						"q66": "1",
						"q67": "3",
						"q68": "2",
						"q69": "1",
						"q70": "5",
						"q71": "3",
						"q72": "2",
						"q73": "1",
						"q74": "5",
						"q75": "2",
						"q76": "1",
						"q77": "3",
						"q78": "2",
						"q79": "1",
						"q80": "5",
						"q81": "3",
						"q82": "2",
						"q83": "1",
						"q84": "5",
						"q85": "2",
						"q86": "1",
						"q87": "3",
						"q88": "2",
						"q89": "1",
						"q90": "5"
					}
				},
				setData: {
					// {
					// 	"surveyId": 1,
					// 	"chooses": [{
					// 			"serialNumber": 1,
					// 			"number": 1
					// 		}
					// 	]
					// }
				},
		
				//进度条
				progress: 0,
		
				currentPoints: 0, //当前积分
				isShare: 3, //是否分享	0否 1是
				userinfo: "",
				showMessage: '' //答题结果
			};
		},
		onShareAppMessage(res) {
			return {
				title: '我已完成答题，快来参与吧'
			};
		},
		onLoad(options) {
			// options 是一个对象，包含传递的所有参数
			const idd = options.id;  // 获取传递的 id 参数
			console.log('传递过来的 id:', idd);
			this.useranswers.idd=idd
			const that = this;
			uni.getSystemInfo({
				success: function(res) {
					that.getHeight = res.windowHeight;
				}
			});
			setTimeout(function() {
				that.loading = true;
			}, 300);

			this.getData();
		},
		watch: {
			progress(val) {
				console.log(this.progress + '% - 进度');

				if (this.progress == 100) {
					
					console.log("答题结束啦");
										
									
					uni.request({
					    url: 'http://202.127.200.31:30010/scale/scl_90', // 请求的URL
					    method: 'POST',
					    data: this.useranswers, // 发送的数据，这里使用的是组件中的useranswers数据
					    header: {
					        'Content-Type': 'application/json' // 设置请求头为JSON格式
					    },
					    success: (res) => {
					        console.log('提交成功:', res.data);
					        this.showMessage = res.data; // 将返回的数据保存到组件的showMessage中
							uni.removeStorageSync('timucach8');
							uni.removeStorageSync('numcach8');
					    },
					    fail: (err) => {
					        console.error('提交失败:', err);
					    }
					});
					this.noData = true;
					this.hasData = false;
					setTimeout(() => {
						this.show = true;
					}, 1300);
				}
			}
		},
		mounted() {
		    // 获取用户信息
		    this.userinfo = uni.getStorageSync("userinfo");
		    if (this.userinfo && this.userinfo.data && this.userinfo.data.userid) {
		        this.useranswers.user_id = this.userinfo.data.userid;
		    }
		    console.log(this.userinfo);
		
		    // 获取缓存的题目和答案数据
		    let numcach = uni.getStorageSync("numcach8");
		    let timucach = uni.getStorageSync("timucach8");
			
		    // 检查数据是否完整
		    if (numcach && timucach) {
		        // 显示弹窗询问用户是否恢复进度
		        uni.showModal({
		            title: '提示',
		            content: '检测到您有历史答题未完成，是否恢复之前的答题进度（取消将重新答题）？',
		            success: (res) => { // 使用箭头函数以保持this上下文
		                if (res.confirm) {
		                    console.log('用户点击确定');
		                    this.num = numcach;
		                    this.useranswers = timucach;
		                    console.log("********************************");
		                    console.log(numcach);
		                    console.log(timucach);
		                    console.log("********************************");
		                } else if (res.cancel) {
							uni.removeStorageSync('timucach8');
							uni.removeStorageSync('numcach8');
		                    console.log('用户点击取消');
		                    // 如果用户取消，可以在此处添加逻辑，例如增加页码，执行动画等
		                    setTimeout(() => {
		                        this.animation = 'animation-slide-left';
		                        this.num=0; // 翻到下一页
		                        setTimeout(() => {
		                            this.mentalListActive = -1;
		                            this.animation = '';
		                        }, 100);
		                    }, 300);
		                }
		            }
		        });
		    } else {
		        // 如果数据不完整，可以选择不做任何事，或者执行其他逻辑，如跳转到登录页面等
				setTimeout(() => {
				    this.animation = 'animation-slide-left';
				    this.num=0; // 翻到下一页
				    setTimeout(() => {
				        this.mentalListActive = -1;
				        this.animation = '';
				    }, 100);
				}, 300);
		    }
		},
		methods: {
	answerchoose(serialNumber, daan, number) {
		console.log(serialNumber, daan, number);
		// 假设useranswers是一个全局对象

		// 构造问题的键名
		let questionKey = `q${serialNumber}`;

		// 检查该问题是否存在于答案对象中
		if (this.useranswers.answers.hasOwnProperty(questionKey)) {
			// 如果存在，更新答案
			if (questionKey == 'q1') {
				this.useranswers.answers[questionKey] = parseInt(daan)+1;
			} else {
				this.useranswers.answers[questionKey] = parseInt(daan)+1;
			}
			console.log('Answer updated:', questionKey, daan);
		} else {
			// 如果问题键不存在，打印错误信息
			console.error('Invalid question serial number:', serialNumber);
		}
	},
	getData() {
		this.progress = 0;
	},
	Toggle(index) {
		// 中途保存
		uni.setStorageSync("numcach8", this.num+1);
		uni.setStorageSync("timucach8", this.useranswers);
		this.mentalListActive = index;
		console.log(this.num + 1);
		console.log('length:', this.DataList.length);
		this.progress = (100 / this.DataList.length) * (this.num + 1); //进度条

		if (this.progress < 100) {
			setTimeout(() => {
				this.animation = 'animation-slide-left';
				this.num++; //翻第二页
				setTimeout(() => {
					this.mentalListActive = -1;
					this.animation = '';
				}, 100);
			}, 300);
		} else {
			console.log('没有下一题了');
			this.show = true;
		}
	},
	// 弹窗消失
	closeMask() {
		this.show = false;
	},
	goExplain() {
		uni.navigateTo({
			url: './explain'
		});
	}
}
	};
</script>

<style lang="scss" scoped>
	@import '@/colorui/animation.css';

	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
	}

	.rect {
		width: 480rpx;
		border-radius: 20rpx;
		padding: 25rpx 25rpx 80rpx 25rpx;
		box-sizing: border-box;
		background-color: #fff;
	}

	.closeImg {
		width: 100%;
		height: 200rpx;
		margin: 10rpx auto 30rpx;

		image {
			height: 200rpx;
		}
	}

	.cu-bar .cu-avatar:first-child {
		margin-left: -11px;
	}

	.cu-bar {
		height: 90rpx !important;
	}

	.mainBox {
		padding: 60rpx 40rpx 20rpx 40rpx;
	}

	.explainMain {
		width: 100%;
		text-align: center;
		font-size: 24rpx;
		text-align: center;
		color: #999999;
		margin-top: 30rpx;
	}

	.userHeard {
		position: absolute;
		left: 50%;
		top: -50rpx;
		margin-left: -50rpx;
	}

	.mentalTitle {
		margin: 0 0 30rpx 0;
	}

	.mentalList {
		width: 100%;
		height: 78rpx;
		line-height: 78rpx;
		padding-right: 20rpx;
		border-radius: 12rpx;
		margin: 30rpx 0;
		overflow: hidden;
		border: 1px solid #dddddd;

		.indexBox {
			width: 70rpx;
			height: 78rpx;
			text-align: center;
			line-height: 78rpx;
			float: left;
			background-color: #dddddd;
			margin-right: 15rpx;
		}
	}

	.mentalListActive {
		width: 100%;
		height: 78rpx;
		line-height: 78rpx;
		padding-right: 20rpx;
		border: 1px solid #0081ff;
		border-radius: 12rpx;
		color: #0081ff;
		margin: 30rpx 0;
		font-weight: 600;
		background-image: url(http://cdn.zhoukaiwen.com/answerYes.png);
		background-repeat: no-repeat;
		background-size: 38rpx;
		background-position: right 30rpx center;

		.indexBox {
			background-color: #0081ff;
			color: #ffffff;
		}
	}

	.contaier {
		background-color: #f2f2f2;

		.explain {
			width: 750rpx;
			font-size: 24rpx;
			margin: 10rpx 0 40rpx 0;
			text-align: center;
			color: #999999;
		}
	}
</style>
